package dhbw.GUI.Panels;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import Main.MyController;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

import dhbw.Data.Language;
import dhbw.Data.Settings;

public class ContentPanelAddress extends JPanel{

	protected JTextField tf_name,tf_vorname,tf_street,tf_city,tf_zipcode,tf_phone,tf_mobile,tf_email;
	private MyController myc;
	
	public ContentPanelAddress(MyController myc)
	{
		this.myc=myc;
		build();
	}
	
	private void build()
	{
		this.setBackground(Settings.BG_COLOR);
		tf_city = new JTextField();
		tf_email = new JTextField();
		tf_mobile = new JTextField();
		tf_name = new JTextField();
		tf_phone = new JTextField();
		tf_street = new JTextField();
		tf_vorname = new JTextField();
		tf_zipcode = new JTextField();
		
		CellConstraints cc = new CellConstraints();
		String cols = "16dlu,40dlu,6dlu,80dlu,16dlu";
		String rows = "6dlu,pref,12dlu,pref,12dlu,pref,12dlu,pref,12dlu,pref,12dlu,pref,12dlu,pref,18dlu,pref,6dlu";
		FormLayout grid = new FormLayout(cols, rows);
		
		this.setLayout(grid);
		this.add(new JLabel(Language.NAME[myc.getLanguage()]), cc.xy(2, 2));
		this.add(tf_name, cc.xy(4, 2));
		
		this.add(new JLabel(Language.SURNAME[myc.getLanguage()]), cc.xy(2, 4));
		this.add(tf_vorname, cc.xy(4, 4));
		
		this.add(new JLabel(Language.STREET[myc.getLanguage()]), cc.xy(2, 6));
		this.add(tf_street, cc.xy(4, 6));

		this.add(new JLabel(Language.ZIPCODE[myc.getLanguage()]), cc.xy(2, 8));
		this.add(tf_zipcode, cc.xy(4, 8));
		this.add(new JLabel(Language.CITY[myc.getLanguage()]), cc.xy(2, 10));
		this.add(tf_city, cc.xy(4,10));
		
		this.add(new JLabel(Language.PHONE[myc.getLanguage()]), cc.xy(2, 12));
		this.add(tf_phone, cc.xy(4, 12));
		this.add(new JLabel(Language.MOBIL[myc.getLanguage()]), cc.xy(2, 14));
		this.add(tf_mobile, cc.xy(4, 14));
		this.add(new JLabel(Language.EMAIL[myc.getLanguage()]), cc.xy(2, 16));
		this.add(tf_email, cc.xy(4, 16));
	}
	
	protected void makeEditable(boolean edit)
	{
		tf_city.setEditable(edit);	
		tf_email.setEditable(edit);
		tf_mobile.setEditable(edit);
		tf_name.setEditable(edit);
		tf_phone.setEditable(edit);
		tf_street.setEditable(edit);
		tf_vorname.setEditable(edit);
		tf_zipcode.setEditable(edit);
	}
	
}
